# -*- coding: utf-8 -*-

inputs = raw_input()
N,C = inputs.split(' ')
N=int(N)
rows=(N+1)/2
print C*N
while rows>2:
    print C+' '*(N-2)+C
    rows-=1
print C*N